/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 2009-7-10, 14:40:41
 */
package calculator;

import java.util.regex.*;

/**
 *
 * @author Administrator
 */
public class NewJFrame extends javax.swing.JFrame {

    /** Creates new form NewJFrame */
    public NewJFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jPanel2 = new javax.swing.JPanel();
        jRadioButton6 = new javax.swing.JRadioButton();
        jRadioButton7 = new javax.swing.JRadioButton();
        jRadioButton5 = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jBfe = new javax.swing.JButton();
        jBs = new javax.swing.JButton();
        jBdat = new javax.swing.JButton();
        jBsta = new javax.swing.JButton();
        jBsum = new javax.swing.JButton();
        jBave = new javax.swing.JButton();
        jBcos = new javax.swing.JButton();
        jBtan = new javax.swing.JButton();
        jBsin = new javax.swing.JButton();
        jBdms = new javax.swing.JButton();
        jBlk = new javax.swing.JButton();
        jBexp = new javax.swing.JButton();
        jBxy = new javax.swing.JButton();
        jBx3 = new javax.swing.JButton();
        jBx2 = new javax.swing.JButton();
        jBrk = new javax.swing.JButton();
        jBln = new javax.swing.JButton();
        jBlog = new javax.swing.JButton();
        jBn = new javax.swing.JButton();
        jB1divx = new javax.swing.JButton();
        jBmc = new javax.swing.JButton();
        jBmr = new javax.swing.JButton();
        jBms = new javax.swing.JButton();
        jBmadd = new javax.swing.JButton();
        jBpi = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jB8 = new javax.swing.JButton();
        jB0 = new javax.swing.JButton();
        jBa = new javax.swing.JButton();
        jB7 = new javax.swing.JButton();
        jB1 = new javax.swing.JButton();
        jB4 = new javax.swing.JButton();
        jBaddsub = new javax.swing.JButton();
        jBb = new javax.swing.JButton();
        jB2 = new javax.swing.JButton();
        jB5 = new javax.swing.JButton();
        jB9 = new javax.swing.JButton();
        jB6 = new javax.swing.JButton();
        jB3 = new javax.swing.JButton();
        jBdot = new javax.swing.JButton();
        jBc = new javax.swing.JButton();
        jBdiv = new javax.swing.JButton();
        jBmul = new javax.swing.JButton();
        jBsub = new javax.swing.JButton();
        jBadd = new javax.swing.JButton();
        jBd = new javax.swing.JButton();
        jBmod = new javax.swing.JButton();
        jBor = new javax.swing.JButton();
        jBlsh = new javax.swing.JButton();
        jBequal = new javax.swing.JButton();
        jBe = new javax.swing.JButton();
        jBand = new javax.swing.JButton();
        jBxor = new javax.swing.JButton();
        jBint = new javax.swing.JButton();
        jBf = new javax.swing.JButton();
        jBnot = new javax.swing.JButton();
        jButton56 = new javax.swing.JButton();
        jButton57 = new javax.swing.JButton();
        jButton58 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setText("十六进制");
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setSelected(true);
        jRadioButton2.setText("十进制");
        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton2ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton3);
        jRadioButton3.setText("二进制");
        jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton3ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton4);
        jRadioButton4.setText("八进制");
        jRadioButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRadioButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jRadioButton2)
                .addGap(18, 18, 18)
                .addComponent(jRadioButton4)
                .addGap(18, 18, 18)
                .addComponent(jRadioButton3))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButton2)
                    .addComponent(jRadioButton4)
                    .addComponent(jRadioButton3)
                    .addComponent(jRadioButton1))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        buttonGroup2.add(jRadioButton6);
        jRadioButton6.setText("弧度");
        jRadioButton6.setEnabled(false);

        buttonGroup2.add(jRadioButton7);
        jRadioButton7.setText("梯度");
        jRadioButton7.setEnabled(false);

        buttonGroup2.add(jRadioButton5);
        jRadioButton5.setText("角度");
        jRadioButton5.setEnabled(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addComponent(jRadioButton5)
                .addGap(10, 10, 10)
                .addComponent(jRadioButton6)
                .addGap(18, 18, 18)
                .addComponent(jRadioButton7)
                .addContainerGap(78, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButton5)
                    .addComponent(jRadioButton6)
                    .addComponent(jRadioButton7))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jCheckBox1.setText("Inv");
        jCheckBox1.setEnabled(false);

        jCheckBox2.setText("Hyp");
        jCheckBox2.setEnabled(false);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jCheckBox1)
                .addGap(41, 41, 41)
                .addComponent(jCheckBox2)
                .addContainerGap(18, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBox1)
                    .addComponent(jCheckBox2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jCheckBox1, jCheckBox2});

        jBfe.setText("F-E");
        jBfe.setEnabled(false);
        jBfe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBfeActionPerformed(evt);
            }
        });

        jBs.setText("s");
        jBs.setEnabled(false);
        jBs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBsActionPerformed(evt);
            }
        });

        jBdat.setText("Dat");
        jBdat.setEnabled(false);
        jBdat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBdatActionPerformed(evt);
            }
        });

        jBsta.setFont(new java.awt.Font("宋体", 1, 12));
        jBsta.setForeground(new java.awt.Color(0, 0, 255));
        jBsta.setText("Sta");
        jBsta.setEnabled(false);
        jBsta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBstaActionPerformed(evt);
            }
        });

        jBsum.setText("Sum");
        jBsum.setEnabled(false);
        jBsum.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBsumActionPerformed(evt);
            }
        });

        jBave.setText("Ave");
        jBave.setEnabled(false);
        jBave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBaveActionPerformed(evt);
            }
        });

        jBcos.setText("cos");
        jBcos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBcosActionPerformed(evt);
            }
        });

        jBtan.setText("tan");
        jBtan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtanActionPerformed(evt);
            }
        });

        jBsin.setText("sin");
        jBsin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBsinActionPerformed(evt);
            }
        });

        jBdms.setText("dms");
        jBdms.setEnabled(false);
        jBdms.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBdmsActionPerformed(evt);
            }
        });

        jBlk.setText("(");
        jBlk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBlkActionPerformed(evt);
            }
        });

        jBexp.setText("Exp");
        jBexp.setEnabled(false);
        jBexp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBexpActionPerformed(evt);
            }
        });

        jBxy.setText("x^y");
        jBxy.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBxyActionPerformed(evt);
            }
        });

        jBx3.setText("x^3");
        jBx3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBx3ActionPerformed(evt);
            }
        });

        jBx2.setText("x^2");
        jBx2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBx2ActionPerformed(evt);
            }
        });

        jBrk.setText(")");
        jBrk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBrkActionPerformed(evt);
            }
        });

        jBln.setText("ln");
        jBln.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBlnActionPerformed(evt);
            }
        });

        jBlog.setText("log");
        jBlog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBlogActionPerformed(evt);
            }
        });

        jBn.setText("n!");
        jBn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBnActionPerformed(evt);
            }
        });

        jB1divx.setText("1/x");
        jB1divx.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB1divxActionPerformed(evt);
            }
        });

        jBmc.setText("MC");
        jBmc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBmcActionPerformed(evt);
            }
        });

        jBmr.setText("MR");
        jBmr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBmrActionPerformed(evt);
            }
        });

        jBms.setText("MS");
        jBms.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBmsActionPerformed(evt);
            }
        });

        jBmadd.setText("M+");
        jBmadd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBmaddActionPerformed(evt);
            }
        });

        jBpi.setText("pi");
        jBpi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBpiActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jBs, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBave, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBsum, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBdat, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBsta))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jBfe)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBlk, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBrk, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBmc))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jBcos, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBx3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBn, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBmadd, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jBtan, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBx2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jB1divx, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBpi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jBdms, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBexp, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBln, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jBsin, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBxy, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBlog, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jBmr, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jBms, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(20, 20, 20))
        );

        jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jB1divx, jBave, jBcos, jBdat, jBdms, jBexp, jBfe, jBlk, jBln, jBlog, jBmadd, jBmc, jBmr, jBms, jBn, jBpi, jBrk, jBs, jBsin, jBsta, jBsum, jBtan, jBx2, jBx3, jBxy});

        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBsta)
                    .addComponent(jBfe)
                    .addComponent(jBlk)
                    .addComponent(jBrk)
                    .addComponent(jBmc))
                .addGap(3, 3, 3)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBave)
                    .addComponent(jBdms)
                    .addComponent(jBexp)
                    .addComponent(jBln)
                    .addComponent(jBmr))
                .addGap(6, 6, 6)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBsin)
                    .addComponent(jBxy)
                    .addComponent(jBlog)
                    .addComponent(jBms)
                    .addComponent(jBsum))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBs)
                    .addComponent(jBcos)
                    .addComponent(jBx3)
                    .addComponent(jBn)
                    .addComponent(jBmadd))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBdat)
                    .addComponent(jBtan)
                    .addComponent(jBx2)
                    .addComponent(jB1divx)
                    .addComponent(jBpi, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jB1divx, jBave, jBcos, jBdat, jBdms, jBexp, jBfe, jBlk, jBln, jBlog, jBmadd, jBmc, jBmr, jBms, jBn, jBpi, jBrk, jBs, jBsin, jBsta, jBsum, jBtan, jBx2, jBx3, jBxy});

        jB8.setText("8");
        jB8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB8ActionPerformed(evt);
            }
        });

        jB0.setText("0");
        jB0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB0ActionPerformed(evt);
            }
        });

        jBa.setText("A");
        jBa.setEnabled(false);
        jBa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBaActionPerformed(evt);
            }
        });

        jB7.setText("7");
        jB7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB7ActionPerformed(evt);
            }
        });

        jB1.setText("1");
        jB1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB1ActionPerformed(evt);
            }
        });

        jB4.setText("4");
        jB4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB4ActionPerformed(evt);
            }
        });

        jBaddsub.setText("+/-");
        jBaddsub.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBaddsubActionPerformed(evt);
            }
        });

        jBb.setText("B");
        jBb.setEnabled(false);
        jBb.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBbActionPerformed(evt);
            }
        });

        jB2.setText("2");
        jB2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB2ActionPerformed(evt);
            }
        });

        jB5.setText("5");
        jB5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB5ActionPerformed(evt);
            }
        });

        jB9.setText("9");
        jB9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB9ActionPerformed(evt);
            }
        });

        jB6.setText("6");
        jB6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB6ActionPerformed(evt);
            }
        });

        jB3.setText("3");
        jB3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB3ActionPerformed(evt);
            }
        });

        jBdot.setText(".");
        jBdot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBdotActionPerformed(evt);
            }
        });

        jBc.setText("C");
        jBc.setEnabled(false);
        jBc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBcActionPerformed(evt);
            }
        });

        jBdiv.setText("/");
        jBdiv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBdivActionPerformed(evt);
            }
        });

        jBmul.setText("*");
        jBmul.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBmulActionPerformed(evt);
            }
        });

        jBsub.setText("-");
        jBsub.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBsubActionPerformed(evt);
            }
        });

        jBadd.setText("+");
        jBadd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBaddActionPerformed(evt);
            }
        });

        jBd.setText("D");
        jBd.setEnabled(false);
        jBd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBdActionPerformed(evt);
            }
        });

        jBmod.setText("Mod");
        jBmod.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBmodActionPerformed(evt);
            }
        });

        jBor.setText("Or");

        jBlsh.setText("Lsh");
        jBlsh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBlshActionPerformed(evt);
            }
        });

        jBequal.setText("=");
        jBequal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBequalActionPerformed(evt);
            }
        });

        jBe.setText("E");
        jBe.setEnabled(false);
        jBe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBeActionPerformed(evt);
            }
        });

        jBand.setText("And");
        jBand.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBandActionPerformed(evt);
            }
        });

        jBxor.setText("Xor");

        jBint.setText("Int");
        jBint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBintActionPerformed(evt);
            }
        });

        jBf.setText("F");
        jBf.setEnabled(false);
        jBf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBfActionPerformed(evt);
            }
        });

        jBnot.setText("Not");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jB0, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jB4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jB1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jB7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBa, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jB8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jB9, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBdiv, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6)
                        .addComponent(jBmod, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jBaddsub, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBdot, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBadd, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBequal, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jBb, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBd, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBe, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(jB5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jB6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBmul, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(jB2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jB3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBsub, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jBlsh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jBor, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jBint, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBnot, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBxor, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBand)
                    .addComponent(jBf, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jB0, jB1, jB2, jB3, jB4, jB5, jB6, jB7, jB8, jB9, jBa, jBadd, jBaddsub, jBand, jBb, jBc, jBd, jBdiv, jBdot, jBe, jBequal, jBf, jBint, jBlsh, jBmod, jBmul, jBnot, jBor, jBsub, jBxor});

        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jB7)
                            .addComponent(jB8)
                            .addComponent(jB9)
                            .addComponent(jBdiv)
                            .addComponent(jBmod))
                        .addGap(3, 3, 3)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jB4)
                            .addComponent(jB5)
                            .addComponent(jB6)
                            .addComponent(jBmul)
                            .addComponent(jBor))
                        .addGap(6, 6, 6)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jB2)
                            .addComponent(jB3)
                            .addComponent(jBsub)
                            .addComponent(jBlsh)
                            .addComponent(jB1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jB0)
                            .addComponent(jBaddsub)
                            .addComponent(jBdot)
                            .addComponent(jBadd)
                            .addComponent(jBequal))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jBa, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jBb)
                            .addComponent(jBc)
                            .addComponent(jBd)
                            .addComponent(jBe)))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jBand)
                        .addGap(3, 3, 3)
                        .addComponent(jBxor)
                        .addGap(6, 6, 6)
                        .addComponent(jBnot)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBint)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBf)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jB0, jB1, jB2, jB3, jB4, jB5, jB6, jB7, jB8, jB9, jBa, jBadd, jBaddsub, jBand, jBb, jBc, jBd, jBdiv, jBdot, jBe, jBequal, jBf, jBint, jBlsh, jBmod, jBmul, jBnot, jBor, jBsub, jBxor});

        jButton56.setText("Backspace");
        jButton56.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton56ActionPerformed(evt);
            }
        });

        jButton57.setText("CE");
        jButton57.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton57ActionPerformed(evt);
            }
        });

        jButton58.setText("C");
        jButton58.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton58ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(103, 103, 103)
                        .addComponent(jButton56)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton57)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton58)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton56, jButton57, jButton58});

        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton56, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton57, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton58, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(18, Short.MAX_VALUE))
        );

        jPanel5Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton56, jButton57, jButton58});

        jTextField1.setEditable(false);
        jTextField1.setFont(new java.awt.Font("Arial", 1, 18));
        jTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTextField1.setText("0");
        jTextField1.setAutoscrolls(false);

        jTextField2.setEditable(false);
        jTextField2.setFont(new java.awt.Font("Arial", 1, 18));
        jTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jTextField3.setEditable(false);
        jTextField3.setFont(new java.awt.Font("Arial", 1, 18));
        jTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jMenu1.setText("文件");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("查看");
        jMenuBar1.add(jMenu2);

        jMenu3.setText("帮助");
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(144, 144, 144)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(31, Short.MAX_VALUE)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 839, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jTextField2, jTextField3});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(8, 8, 8)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jTextField2, jTextField3});

        pack();
    }// </editor-fold>//GEN-END:initComponents
    public static final String NUM_PATTERN = //数字的匹配模式
            "(?:(?<=[\\+\\-\\*\\(/]|^)[+-]|)" //前缀判断,判断前面的+-是否为符号
            + "(?:" //数字及小数点部分, 0. 以及 .0 都是合法的数字
            + "(?:\\d*\\.)?\\d+|" //.0 的情形
            + "\\d+(?:\\.\\d*)?" //0. 的情形
            + ")" + "(?!\\d|\\.)"; //边界条件
    public static final String BRA_PATTERN =
            "\\((NUM)\\)".replace("NUM", NUM_PATTERN);
    public static final String ADD_PATTERN =
            "(NUM)\\+(NUM)".replace("NUM", NUM_PATTERN);
    public static final String SUB_PATTERN =
            "(NUM)-(NUM)".replace("NUM", NUM_PATTERN);
    public static final String MUL_PATTERN =
            "(NUM)\\*(NUM)".replace("NUM", NUM_PATTERN);
    public static final String DIV_PATTERN =
            "(NUM)/(NUM)".replace("NUM", NUM_PATTERN);
    public static final String POW_PATTERN =
            "(NUM)\\^(NUM)".replace("NUM", NUM_PATTERN);
    public static final String MOD_PATTERN =
            "(NUM)\\%(NUM)".replace("NUM", NUM_PATTERN);
    public static final Pattern BRA = Pattern.compile(BRA_PATTERN);
    public static final Pattern ADD_OR_SUB = Pattern.compile("(?<=[^\\+\\-\\*/]|^)(?:" + ADD_PATTERN + "|" + SUB_PATTERN + ")(?=[^\\*/]|$)");
    public static final Pattern MUL_OR_DIV = Pattern.compile("(?<![\\*/])(?:" + MUL_PATTERN + "|" + DIV_PATTERN + ")");
    public static final Pattern POW_OR_MOD = Pattern.compile("(?<![\\^])(?:" + POW_PATTERN + ")(?<![\\^])|(?<![\\^])(?:" + MOD_PATTERN + ")(?<![\\^])");

    private static double operator(Matcher m, int index) {
        index = index * 2;

        double a, b;
        if (m.group(1) != null) {
            a = Double.parseDouble(m.group(1));
            b = Double.parseDouble(m.group(2));
        } else {
            index++;
            a = Double.parseDouble(m.group(3));
            b = Double.parseDouble(m.group(4));
        }
        double r = 0.0;

        switch (index) {
            case 0:
                r = a + b;
                break;
            case 1:
                r = a - b;
                break;
            case 2:
                r = a * b;
                break;
            case 3:
                r = a / b;
                break;
            case 4:
                r = Math.pow(a, b);
                break;
            case 5:
                int n1,
                 n2;
                n1 = (int) a;
                n2 = (int) b;
                r = n1 % n2;
                break;
        }
        return r;
    }

    public static double eval(String str) {
        str = str.replace("=", "");
        StringBuilder sb = new StringBuilder(str.replaceAll("\\s+", ""));
        while (true) {
            Matcher m = BRA.matcher(sb);
            if (m.find()) {
                sb.replace(m.start(), m.end(), m.group(1));
            } else {
                int index = 2;
                m = POW_OR_MOD.matcher(sb);
                if (!m.find()) {
                    index--;
                    m = MUL_OR_DIV.matcher(sb);
                    if (!m.find()) {
                        index--;
                        m = ADD_OR_SUB.matcher(sb);
                        if (!m.find()) {
                            break;
                        }
                    }
                }
                sb.replace(m.start(), m.end(), "" + operator(m, index));
            }
        }
        return Double.parseDouble(sb.toString());
    }
    private void jBstaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBstaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBstaActionPerformed

    private void jBmcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBmcActionPerformed
        // TODO add your handling code here:
        memoryd = 0.0;
        jTextField3.setText("");
        input = "";
    }//GEN-LAST:event_jBmcActionPerformed

    private void jBandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBandActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBandActionPerformed

    private void jB7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB7ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "7";
        jTextField1.setText(input);
    }//GEN-LAST:event_jB7ActionPerformed

    private void jB8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB8ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "8";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB8ActionPerformed

    private void jB4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB4ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "4";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB4ActionPerformed

    private void jB1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB1ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "1";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB1ActionPerformed

    private void jB2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB2ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "2";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB2ActionPerformed

    private void jB9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB9ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "9";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB9ActionPerformed

    private void jB5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB5ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "5";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB5ActionPerformed

    private void jB6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB6ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "6";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB6ActionPerformed

    private void jB3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB3ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "3";
        jTextField1.setText(input);


    }//GEN-LAST:event_jB3ActionPerformed

    private void jB0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB0ActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "0";
        jTextField1.setText(input);

    }//GEN-LAST:event_jB0ActionPerformed

    private void jBaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBaActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "A";
        jTextField1.setText(input);

    }//GEN-LAST:event_jBaActionPerformed

    private void jBbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBbActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "B";
        jTextField1.setText(input);

    }//GEN-LAST:event_jBbActionPerformed

    private void jBcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBcActionPerformed
        // TODO add your handling code here:

        input = input + "C";
        jTextField1.setText(input);

    }//GEN-LAST:event_jBcActionPerformed

    private void jBdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBdActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "D";
        jTextField1.setText(input);

    }//GEN-LAST:event_jBdActionPerformed

    private void jBeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBeActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "E";
        jTextField1.setText(input);

    }//GEN-LAST:event_jBeActionPerformed

    private void jBfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBfActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            result = 0.0;
        }
        input = input + "F";
        jTextField1.setText(input);

    }//GEN-LAST:event_jBfActionPerformed

    private void jButton58ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton58ActionPerformed
        // TODO add your handling code here:
        //num1 = num2 = 0.0;
        result = 0.0;
        input = "";
        jTextField1.setText("0");
    }//GEN-LAST:event_jButton58ActionPerformed

    private void jButton57ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton57ActionPerformed
        // TODO add your handling code here:
        input = "";
        jTextField1.setText("0");
    }//GEN-LAST:event_jButton57ActionPerformed

    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jRadioButton1ActionPerformed

    private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton4ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jRadioButton4ActionPerformed

    private void jBdotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBdotActionPerformed
        // TODO add your handling code here:
        boolean isdot = false;
        for (int i = 0; i < jTextField1.getText().length(); i++) {
            if ('.' == jTextField1.getText().charAt(i)) {
                isdot = true;
                break;
            }
        }
        if (isdot == false) {
            if (jTextField1.getText().length() == 0) {
                input = input + "0.";
                jTextField1.setText(input);
            } else {
                input = input + ".";
                jTextField1.setText(input);
            }

        }


    }//GEN-LAST:event_jBdotActionPerformed

    private void jBaddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBaddActionPerformed
        // TODO add your handling code here:
        if (result != 0.0)
        {
            input = result + "";
            result = 0.0;
        }
        input = input + "+";
        jTextField1.setText(input);
        /* if (type1 == 1) {
        num2 = Double.parseDouble(input);
        input = "";
        num1 = num1 + num2;
        jTextField1.setText(num1 + "");

        } else {
        num1 = Double.parseDouble(input);
        input = "";
        }
        flag = 0;
        type = 1;*/
    }//GEN-LAST:event_jBaddActionPerformed

    private void jBsubActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBsubActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            input = result + "";
            result = 0.0;
        }
        input = input + "-";
        jTextField1.setText(input);
        /* if (type == 2) {
        num2 = Double.parseDouble(input);
        input = "";
        if (flag == 0) {
        result = num1 - num2;
        }
        jTextField1.setText(num1 + "");
        } else {
        if (!input.equals("")) //第一操作数非空，进行的是减法
        {
        num1 = Double.parseDouble(input);
        flag = 0;
        input = "";
        } else {
        flag = 1;
        input = "-";
        jTextField1.setText(input);
        }
        }
        type = 2;*/
    }//GEN-LAST:event_jBsubActionPerformed

    private void jBmulActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBmulActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            input = result + "";
            result = 0.0;
        }
        input = input + "*";
        jTextField1.setText(input);
        /*if (type == 3) {
        num2 = Double.parseDouble(input);
        input = "";
        num1 = num1 * num2;
        jTextField1.setText(num1 + "");

        } else {
        num1 = Double.parseDouble(input);
        input = "";
        }
        type = 3;
        flag = 0;*/

    }//GEN-LAST:event_jBmulActionPerformed

    private void jBdivActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBdivActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            input = result + "";
            result = 0.0;
        }
        input = input + "/";
        jTextField1.setText(input);
        /*if (type == 4) {
        num2 = Double.parseDouble(input);
        input = "";
        if (num2 != 0) {
        num1 = num1 / num2;
        jTextField1.setText(num1 + "");
        } else {
        jTextField1.setText("0不可作除数");
        }
        } else {
        num1 = Double.parseDouble(input);
        input = "";
        }
        type = 4;
        flag = 0;*/
    }//GEN-LAST:event_jBdivActionPerformed

    private void jButton56ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton56ActionPerformed
        // TODO add your handling code here:
        int count = input.length();
        if (count != 0) {
            input = input.substring(0, count - 1);//获取长度为n个的字符串的后n-1个
        }
        jTextField1.setText(input);
    }//GEN-LAST:event_jButton56ActionPerformed

    private void jBmodActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBmodActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            input = result + "";
            result = 0.0;
        }
        input = input + "%";
        jTextField1.setText(input);
        /*if (type == 5) {
        num2 = Double.parseDouble(input);
        input = "";
        int n1, n2;
        if (num2 != 0) {
        n1 = (int) num1;
        n2 = (int) num2;
        num1 = n1 % n2;
        }
        jTextField1.setText(num1 + "");

        } else {
        num1 = Double.parseDouble(input);
        input = "";
        }
        type = 5;
        flag = 0;*/
    }//GEN-LAST:event_jBmodActionPerformed

    private void jBaddsubActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBaddsubActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
             input = result + "";
            result = 0.0;
        }
        if (flag == 0) {
            flag = 1;
            input = "-" + input;
        } else {
            flag = 0;
            input = input.substring(1);
        }
        jTextField1.setText(input);
    }//GEN-LAST:event_jBaddsubActionPerformed

    private void jBequalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBequalActionPerformed
        // TODO add your handling code here:
        result = eval(input);
        input = "";
         jTextField1.setText(result + "");
        /*if (type != 0) {
        num2 = Double.parseDouble(input);
        if (type == 1) //进行加法操作
        {
        result = num1 + num2;
        }
        if (type == 2) //进行减法操作
        {
        if (flag == 0) {
        result = num1 - num2;
        } else {
        num1 = Double.parseDouble(input);
        }
        }
        if (type == 3) //进行乘法操作
        {
        result = num1 * num2;
        }
        if (type == 4) //进行除法操作
        {
        if (num2 != 0) {
        result = num1 / num2;
        } else {
        jTextField1.setText("0不可作除数");
        }
        }
        if (type == 5) //进行求余数操作
        {
        int n1, n2;
        if (num2 != 0) {
        n1 = (int) num1;
        n2 = (int) num2;
        result = n1 % n2;
        }
        }
        if (type == 6) {
        result = Math.pow(num1, num2);
        }
        type = 0;
        input = "";
        if (flag == 0) {
        num1 = num2 = 0.0;
        jTextField1.setText(result + "");
        } else {
        flag = 0;
        jTextField1.setText(result + "");
        }
        }*/
    }//GEN-LAST:event_jBequalActionPerformed

    private void jBsinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBsinActionPerformed
        // TODO add your handling code here:
        result = Math.sin(Double.parseDouble(input));
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBsinActionPerformed

    private void jBcosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBcosActionPerformed
        // TODO add your handling code here:
        result = Math.cos(Double.parseDouble(input));
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBcosActionPerformed

    private void jBtanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtanActionPerformed
        // TODO add your handling code here:
        result = Math.tan(Double.parseDouble(input));
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBtanActionPerformed

    private void jBx2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBx2ActionPerformed
        // TODO add your handling code here:
        result = Math.pow(Double.parseDouble(input), 2);
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBx2ActionPerformed

    private void jBx3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBx3ActionPerformed
        // TODO add your handling code here:
        result = Math.pow(Double.parseDouble(input), 3);
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBx3ActionPerformed

    private void jBxyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBxyActionPerformed
        // TODO add your handling code here:
                if (result != 0.0)
        {
            input = result + "";
            result = 0.0;
        }
        input = input + "^";
        jTextField1.setText(input);
        /*if (type == 6) {
        jTextField1.setText(Math.pow(num1, num2) + "");
        } else {
        type = 6;
        num1 = Double.parseDouble(input);
        input = "";
        }*/
    }//GEN-LAST:event_jBxyActionPerformed

    private void jBexpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBexpActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBexpActionPerformed

    private void jBlkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBlkActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBlkActionPerformed

    private void jBrkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBrkActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBrkActionPerformed

    private void jBlnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBlnActionPerformed
        // TODO add your handling code here:
        result = Math.log10(Double.parseDouble(input));
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBlnActionPerformed

    private void jBlogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBlogActionPerformed
        // TODO add your handling code here:
        result = Math.log(Double.parseDouble(input));
        input = "";
        jTextField1.setText(result + "");

    }//GEN-LAST:event_jBlogActionPerformed

    private void jBnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBnActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBnActionPerformed

    private void jB1divxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB1divxActionPerformed
        // TODO add your handling code here:
        if (Double.parseDouble(input) == 0.0) {
            result = 1 / Double.parseDouble(input);
            jTextField1.setText(result + "");
        } else {
            jTextField1.setText("0不可以为分母!");
        }
        input = "";
    }//GEN-LAST:event_jB1divxActionPerformed

    private void jBpiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBpiActionPerformed
        // TODO add your handling code here:
        result = Math.PI;
        input = "";
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBpiActionPerformed

    private void jBmaddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBmaddActionPerformed
        // TODO add your handling code here:
        memoryd += Double.parseDouble(jTextField1.getText());
        jTextField3.setText("M");
        input = "";
    }//GEN-LAST:event_jBmaddActionPerformed

    private void jBmsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBmsActionPerformed
        // TODO add your handling code here:
        memoryd = Double.parseDouble(jTextField1.getText());
        jTextField3.setText("M");
        input = "";

    }//GEN-LAST:event_jBmsActionPerformed

    private void jBmrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBmrActionPerformed
        // TODO add your handling code here:
        jTextField1.setText(Double.toString(memoryd));
        input = "";
    }//GEN-LAST:event_jBmrActionPerformed

    private void jBaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBaveActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBaveActionPerformed

    private void jBsumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBsumActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBsumActionPerformed

    private void jBsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBsActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBsActionPerformed

    private void jBdatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBdatActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBdatActionPerformed

    private void jBfeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBfeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBfeActionPerformed

    private void jBdmsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBdmsActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jBdmsActionPerformed

    private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButton2ActionPerformed

    private void jBlshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBlshActionPerformed
        // TODO add your handling code here:
        int i;
        i = Integer.parseInt(jTextField1.getText());
        String lshresult = Integer.toBinaryString(i >> 1);
        jTextField1.setText(lshresult);
    }//GEN-LAST:event_jBlshActionPerformed

    private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed
        // TODO add your handling code here:
        int i;
        i = Integer.parseInt(jTextField1.getText());

    }//GEN-LAST:event_jRadioButton3ActionPerformed

    private void jBintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBintActionPerformed
        // TODO add your handling code here:
        result = Integer.parseInt(jTextField1.getText());
        jTextField1.setText(result + "");
    }//GEN-LAST:event_jBintActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton jB0;
    private javax.swing.JButton jB1;
    private javax.swing.JButton jB1divx;
    private javax.swing.JButton jB2;
    private javax.swing.JButton jB3;
    private javax.swing.JButton jB4;
    private javax.swing.JButton jB5;
    private javax.swing.JButton jB6;
    private javax.swing.JButton jB7;
    private javax.swing.JButton jB8;
    private javax.swing.JButton jB9;
    private javax.swing.JButton jBa;
    private javax.swing.JButton jBadd;
    private javax.swing.JButton jBaddsub;
    private javax.swing.JButton jBand;
    private javax.swing.JButton jBave;
    private javax.swing.JButton jBb;
    private javax.swing.JButton jBc;
    private javax.swing.JButton jBcos;
    private javax.swing.JButton jBd;
    private javax.swing.JButton jBdat;
    private javax.swing.JButton jBdiv;
    private javax.swing.JButton jBdms;
    private javax.swing.JButton jBdot;
    private javax.swing.JButton jBe;
    private javax.swing.JButton jBequal;
    private javax.swing.JButton jBexp;
    private javax.swing.JButton jBf;
    private javax.swing.JButton jBfe;
    private javax.swing.JButton jBint;
    private javax.swing.JButton jBlk;
    private javax.swing.JButton jBln;
    private javax.swing.JButton jBlog;
    private javax.swing.JButton jBlsh;
    private javax.swing.JButton jBmadd;
    private javax.swing.JButton jBmc;
    private javax.swing.JButton jBmod;
    private javax.swing.JButton jBmr;
    private javax.swing.JButton jBms;
    private javax.swing.JButton jBmul;
    private javax.swing.JButton jBn;
    private javax.swing.JButton jBnot;
    private javax.swing.JButton jBor;
    private javax.swing.JButton jBpi;
    private javax.swing.JButton jBrk;
    private javax.swing.JButton jBs;
    private javax.swing.JButton jBsin;
    private javax.swing.JButton jBsta;
    private javax.swing.JButton jBsub;
    private javax.swing.JButton jBsum;
    private javax.swing.JButton jBtan;
    private javax.swing.JButton jButton56;
    private javax.swing.JButton jButton57;
    private javax.swing.JButton jButton58;
    private javax.swing.JButton jBx2;
    private javax.swing.JButton jBx3;
    private javax.swing.JButton jBxor;
    private javax.swing.JButton jBxy;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JRadioButton jRadioButton6;
    private javax.swing.JRadioButton jRadioButton7;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    // End of variables declaration//GEN-END:variables
    private double result, //result记录计算结果
            //num1 = 0.0, //记录操作数1
            //num2 = 0.0, //记录操作数2
            //num3 = 0.0, //记录操作数3
            //num4 = 0.0, //记录操作数4
            memoryd;   //记录M里保存的值
    private String input = new String(); //记录输入的字符串
    private int type = 0;
    //private int type = 0, type1 = 0, type2 = 0; //标识运算类型:1－加法2－减法 3－乘法 4－除法 5－求余数 6-求幂
    //private int typecount = 0; //记录运算符号数量
    private int flag = 0;  //标识第一个操作数是否是负数
}
